<template>
  <div class="ticket">
    <el-page-header @back="goBack" content="电影购票"></el-page-header>
    <div class="ticket_box"></div>
    <div class="no_film" v-if="list.length === 0">影院还没有添加排片</div>
    <div class="ticket_item" v-for="(item, index) in list" :key="index">
      <div class="ticket_info">
        <div class="d1">{{ film.name }}</div>
        <div class="d2">{{ item.data }} {{ item.startTime }}</div>
        <el-tag effect="plain">{{ item.type }}</el-tag>
      </div>
      <div class="item-btn">
        <el-button type="danger" @click="handleSelectSeat(item.id)" round
          >选座购票</el-button
        >
      </div>
      <div class="item-price">￥{{ item.price }}</div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [
        {
          data: "2022-1-15",
          startTime: "15:30",
          type: "3D放映",
          price: "45",
        },
        {
          data: "2022-2-14",
          startTime: "10:50",
          type: "2D放映",
          price: "40",
        },
        {
          data: "2022-3-22",
          startTime: "18:00",
          type: "中国巨幕",
          price: "55",
        },
      ],
      film: {
        name: "小小愿望",
      },
    };
  },
  methods: {
    goBack() {
      this.$router.go(-1);
    },
    handleSelectSeat(id) {
      this.$router.push("/seat");
    },
  },
};
</script>

<style lang="scss">
.ticket {
  .ticket_box {
    width: 100%;
    height: 20px;
  }
  .no_film {
    font-weight: bold;
    letter-spacing: 2px;
    font-size: 25px;
    color: red;
  }
  .ticket_item {
    padding-top: 20px;
    height: 100px;
    .ticket_info {
      float: left;
      .d1 {
        font-size: 15px;
        letter-spacing: 2px;
        padding-bottom: 7px;
      }
      .d2 {
        font-size: 13px;
        letter-spacing: 1px;
        padding-bottom: 7px;
        color: #999;
      }
    }
  }
  .item-btn {
    float: right;
    padding-top: 30px;
    padding-left: 50px;
  }
  .item-price {
    float: right;
    color: #f34d41;
    line-height: 100px;
  }
}
</style>